package ch.elektroplan.mueller.passwordSave.presentation;

import ch.elektroplan.mueller.passwordSave.R;
import ch.elektroplan.mueller.passwordSave.business.PasswordSafe;
import ch.elektroplan.mueller.passwordSave.presentation.onClicklisteners.ShowPasswordListener;
import android.app.Activity;
import android.os.Bundle;
import android.widget.Button;
import android.widget.LinearLayout;

public class PasswordlistActivity extends Activity {

	private PasswordSafe passwordSafe;
	private LinearLayout linearLayout;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.passwordlist);
		

		passwordSafe = new PasswordSafe(this);

		linearLayout = (LinearLayout) findViewById(R.id.ll_pwlist);

		for (int i = 0; i < passwordSafe.getNamesArr().length; i++) {

			Button button = new Button(this);
			button.setText(passwordSafe.getNamesArr()[i]);

			button.setOnClickListener(new ShowPasswordListener(this, passwordSafe.getWordsArr()[i]));

			linearLayout.addView(button);

		}
	}

}
